import { _decorator, Component, Node ,
    Vec3,
    v3,
    tween
} from 'cc';
const { ccclass, property} = _decorator;

@ccclass('Player')
export class Player extends Component {
    /* class member could be defined like this */
    // dummy = '';

    /* use `property` decorator if your want the member to be serializable */
    // @property
    // serializableDummy = 0;

    _bJumping = false;

    start () {
        // Your initialization goes here.
    }

    // update (deltaTime: number) {
    //     // Your update function goes here.
    // }


    jump(){
        if(this._bJumping){
            return;
        }
        this._bJumping = true;

        // 执行一个简单的上跳
        tween(this.node)
            .by(0.1,{position:v3(0,2,0)})
            .by(0.1,{position:v3(0,-2,0)})
            .call(()=>{
                this._bJumping = false;
            }).start();
    }
}
